Algolia uses facets for categorizing and grouping your data. Users can use facets to refine their search.
author
or genre
.brand
or designer
.facets
parameter at query time.
For example, retrieve your books’ facets by specifying the following list:
*
).
facets
parameter is empty, the engine returns no facet information.AND
(conjunctive) and OR
(disjunctive) operators. When using these operators, the engine handles the facet counts differently to keep a consistent user experience. This doesn’t happen at the API level but in the InstantSearch libraries.
hierarchicalMenu
widget from the InstantSearch libraries helps you to build hierarchical faceting.
exhaustiveFacetsCount
property in the JSON response.
maxValuesPerFacet
parameter. The maximum is 1,000 facet values at a time.
objectID
objectID
attribute, and the engine ignores it if you declare it in attributesForFaceting
. Faceting on a unique identifier makes little sense, though, because every facet count would be 1.
objectID
attribute as a filter-only facet. You can filter on that attribute (even without declaring it in attributesForFaceting
but not get any facet counts.attributesForFaceting
are case-sensitive: they must exactly match the attribute names in your records. The facetFilters
and filters
parameters are only case-insensitive for values.
For example, if your records include an attribute named color
, with values such as “blue”, “red”, and “green”, you must declare color
(not Color
) within your attributesForFaceting
. However, you can facet and filter using color:BLUE
, color:Blue
, or color:blue
.
As an exception, facetFilters
and filters
are case-sensitive when filtering on objectID
. For example, objectID:abc
only returns the record with that specific objectID
, not one with objectID:ABC
.
search_for_facet_values
to let users search within a specific faceted attribute (for example, brands
, authors
, or categories
) without needing to create a separate index. It means you can still display the first, most common values for each facet but also let users search for more.
By default, returned facet values are sorted by count.
maxFacetHits
parameter.